﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BA2009.Entities;
using BA2009.Data.DataAccess;

namespace BA2009.Services
{
    public abstract  class ServiceBase<T>:IService<T>
        where T:EntityBase
    {
        protected IRepository<T> repository = null;

        #region IService<T> Members

        public IList<T> FindAll()
        {
            return repository.FindAll().ToList();
        }

        public T GetById(int id)
        {
            return repository.GetById(id);
        }

        public int Add(T item, params object[] maps)
        {
            return repository.Add(item,maps);
            
        }

        public bool Delete(T item)
        {
            return repository.Delete(item);
        }

        public int Update(T item, params object[] maps)
        {
            return repository.Update(item,maps);
        }

        #endregion

        
    }
}
